<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const a1 = 1;
      function foo1() {
        const a2 = 2;
        function foo2() {
          const a3 = 3;
          function foo3() {
            const a4 = 4;
            console.log(a1, a2, a3, a4);
          }
          foo3();
        }
        foo2();
      }
      foo1();
    </script>
  </body>
</html>
